<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>Board game project: include/Game.h Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />

<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>

</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">Board game project
   &#160;<span id="projectnumber">1.0</span>
   </div>
   <div id="projectbrief">A Board game software</div>
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.8.0 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="dir_d44c64559bbebec7f509842c48db8b23.html">include</a>      </li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="headertitle">
<div class="title">Game.h</div>  </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef GAME_H</span>
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define GAME_H</span>
<a name="l00003"></a>00003 <span class="preprocessor"></span><span class="preprocessor">#include &lt;string&gt;</span>
<a name="l00004"></a>00004 <span class="preprocessor">#include &lt;iostream&gt;</span>
<a name="l00005"></a>00005 <span class="preprocessor">#include &lt;vector&gt;</span>
<a name="l00006"></a>00006 <span class="preprocessor">#include &quot;Piece.h&quot;</span>
<a name="l00007"></a>00007 
<a name="l00008"></a>00008 <span class="keyword">namespace </span>DifficultyLevel
<a name="l00009"></a>00009 {
<a name="l00014"></a>00014     <span class="keyword">enum</span> Enum
<a name="l00015"></a>00015     {
<a name="l00016"></a>00016         Random,
<a name="l00017"></a>00017         Easy,
<a name="l00018"></a>00018         Medium,
<a name="l00019"></a>00019         Hard
<a name="l00020"></a>00020     };
<a name="l00021"></a>00021 }
<a name="l00022"></a>00022 
<a name="l00023"></a>00023 <span class="keyword">extern</span> DifficultyLevel::Enum difficulty;
<a name="l00024"></a>00024 
<a name="l00029"></a><a class="code" href="struct_m_o_v_e.html">00029</a> <span class="keyword">struct </span><a class="code" href="struct_m_o_v_e.html" title="A MOVE struct.">MOVE</a> {
<a name="l00030"></a>00030         <span class="keywordtype">int</span> fromX;
<a name="l00031"></a>00031         <span class="keywordtype">int</span> fromY;
<a name="l00032"></a>00032         <span class="keywordtype">int</span> toX;
<a name="l00033"></a>00033         <span class="keywordtype">int</span> toY;
<a name="l00034"></a>00034 
<a name="l00035"></a>00035         <a class="code" href="struct_m_o_v_e.html" title="A MOVE struct.">MOVE</a>() { }
<a name="l00036"></a>00036 
<a name="l00043"></a><a class="code" href="struct_m_o_v_e.html#a776960a8a4185a0d8b45045f6cdde8fe">00043</a>         <a class="code" href="struct_m_o_v_e.html" title="A MOVE struct.">MOVE</a>(<span class="keywordtype">int</span> fx, <span class="keywordtype">int</span> fy, <span class="keywordtype">int</span> tx, <span class="keywordtype">int</span> ty)
<a name="l00044"></a>00044                 :fromX(fx), fromY(fy), toX(tx), toY(ty)
<a name="l00045"></a>00045         {
<a name="l00046"></a>00046         }
<a name="l00047"></a>00047 
<a name="l00054"></a><a class="code" href="struct_m_o_v_e.html#ab595f623b86dcd849125b2fad9d231bc">00054</a>         <span class="keywordtype">bool</span> <a class="code" href="struct_m_o_v_e.html#ab595f623b86dcd849125b2fad9d231bc" title="MOVE comparison operator.">operator==</a>(<span class="keyword">const</span> <a class="code" href="struct_m_o_v_e.html" title="A MOVE struct.">MOVE</a>&amp; rhs)
<a name="l00055"></a>00055         {
<a name="l00056"></a>00056             <span class="keywordflow">return</span> (fromX == rhs.fromX &amp;&amp; fromY == rhs.fromY
<a name="l00057"></a>00057              &amp;&amp; toX == rhs.toX &amp;&amp; toY == rhs.toY);
<a name="l00058"></a>00058         }
<a name="l00059"></a>00059 
<a name="l00065"></a><a class="code" href="struct_m_o_v_e.html#a1301b46feff346eec702e267bf1c45e9">00065</a>         <span class="keywordtype">void</span> <a class="code" href="struct_m_o_v_e.html#a1301b46feff346eec702e267bf1c45e9" title="MOVE assignment operator.">operator= </a>(<span class="keyword">const</span> <a class="code" href="struct_m_o_v_e.html" title="A MOVE struct.">MOVE</a> &amp;move)
<a name="l00066"></a>00066         {
<a name="l00067"></a>00067                 fromX = move.fromX;
<a name="l00068"></a>00068                 fromY = move.fromY;
<a name="l00069"></a>00069                 toX = move.toX;
<a name="l00070"></a>00070                 toY = move.toY;
<a name="l00071"></a>00071         }
<a name="l00072"></a>00072         <span class="keywordtype">void</span> print()
<a name="l00073"></a>00073         {
<a name="l00074"></a>00074                 std::cout &lt;&lt; fromX &lt;&lt; <span class="stringliteral">&quot;,&quot;</span> &lt;&lt; fromY &lt;&lt; <span class="stringliteral">&quot; to &quot;</span> &lt;&lt; toX &lt;&lt; <span class="stringliteral">&quot;,&quot;</span> &lt;&lt; toY &lt;&lt; <span class="stringliteral">&quot;\n&quot;</span>;
<a name="l00075"></a>00075         }
<a name="l00076"></a>00076 
<a name="l00077"></a>00077 };
<a name="l00078"></a>00078 
<a name="l00079"></a>00079 <span class="keyword">typedef</span> std::vector&lt;Piece*&gt; PieceVector;
<a name="l00080"></a>00080 <span class="keyword">typedef</span> std::vector&lt;PieceVector&gt; GameBoard;
<a name="l00081"></a>00081 
<a name="l00086"></a><a class="code" href="class_game.html">00086</a> <span class="keyword">class </span><a class="code" href="class_game.html" title="A Game class.">Game</a>
<a name="l00087"></a>00087 {
<a name="l00088"></a>00088     <span class="keyword">public</span>:
<a name="l00093"></a>00093         <a class="code" href="class_game.html#ad59df6562a58a614fda24622d3715b65" title="Game constructor.">Game</a>();
<a name="l00094"></a>00094 
<a name="l00095"></a>00095         <span class="keyword">virtual</span> ~<a class="code" href="class_game.html" title="A Game class.">Game</a>();
<a name="l00096"></a>00096 
<a name="l00101"></a>00101         <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_game.html#a2e7c8cb10506b66e7d95a6efd21e778c" title="Set Board.">setBoard</a>() = 0;
<a name="l00102"></a>00102 
<a name="l00107"></a>00107         <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_game.html#add988158041df85337995e36f06756aa" title="Start game.">start</a>() = 0;
<a name="l00108"></a>00108 
<a name="l00114"></a>00114         <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_game.html#a6f3a33940524b6ba9d83f627ccb14bbf" title="Init game.">init</a>();
<a name="l00115"></a>00115 
<a name="l00120"></a>00120         <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_game.html#a63c52c475debbced9961d7fd1e02366e" title="Display Board.">displayBoard</a>();
<a name="l00121"></a>00121 
<a name="l00129"></a>00129         <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_game.html#acfbe6d42cabd6bf9820b8ccf13cda6cb" title="Move Piece.">movePiece</a>(<span class="keywordtype">int</span> fromX, <span class="keywordtype">int</span> fromY, <span class="keywordtype">int</span> toX, <span class="keywordtype">int</span> toY) = 0;
<a name="l00130"></a>00130 
<a name="l00136"></a>00136                 std::vector&lt;MOVE&gt; <a class="code" href="class_game.html#a0d3ea96a10483373b8f150e6c310384b" title="Get legal moves.">legal</a>();
<a name="l00137"></a>00137 
<a name="l00144"></a>00144                 <span class="keyword">virtual</span> std::vector&lt;MOVE&gt; <a class="code" href="class_game.html#a0d3ea96a10483373b8f150e6c310384b" title="Get legal moves.">legal</a>(GameBoard state) = 0;
<a name="l00145"></a>00145 
<a name="l00151"></a>00151                 <span class="keywordtype">bool</span> <a class="code" href="class_game.html#a5892bcd9a13b8484f74ef317b484049c" title="Is Terminal.">isTerminal</a>();
<a name="l00152"></a>00152 
<a name="l00157"></a>00157         <span class="keywordtype">void</span> <a class="code" href="class_game.html#a9be0655102af94f1a37a7eaec1be36fc" title="Retract.">retract</a>();
<a name="l00158"></a>00158 
<a name="l00164"></a>00164         <span class="keywordtype">int</span> <a class="code" href="class_game.html#a9fb895bd0ce0684a2cf95d3d212487df" title="Evaluate.">evaluate</a>();
<a name="l00165"></a>00165 
<a name="l00170"></a>00170         <span class="keywordtype">void</span> <a class="code" href="class_game.html#aafc474b47e358aa7d811f750591b8624" title="Toggle Debug.">toggleDebug</a>();
<a name="l00171"></a>00171 
<a name="l00177"></a>00177         std::string <a class="code" href="class_game.html#a7787bfc933ac23efb386abd7a948f2fe" title="Get Game Name.">getGameName</a>() <span class="keyword">const</span>;
<a name="l00178"></a>00178 
<a name="l00184"></a>00184         <span class="keywordtype">int</span> <a class="code" href="class_game.html#a764ec7d2e552fe43ee28b077a1552262" title="Get Current Player.">getCurrentPlayer</a>() <span class="keyword">const</span>;
<a name="l00185"></a>00185 
<a name="l00190"></a>00190                 <span class="keywordtype">void</span> <a class="code" href="class_game.html#ab1a703bda25ab15b67e13e94d7d47437" title="Check for winner.">checkForWinner</a>();
<a name="l00191"></a>00191 
<a name="l00197"></a>00197                 <span class="keyword">virtual</span> <span class="keywordtype">int</span> <a class="code" href="class_game.html#a188c50dbdf4bdc68deadf87e5b8cf087" title="Winning state.">winningState</a>();
<a name="l00198"></a>00198 
<a name="l00199"></a>00199                 <span class="keyword">virtual</span> <span class="keywordtype">int</span> advancedEvaluate() = 0;
<a name="l00200"></a>00200 
<a name="l00201"></a>00201     <span class="keyword">protected</span>:
<a name="l00207"></a>00207         <span class="keywordtype">void</span> <a class="code" href="class_game.html#a8bdc3bec6db76d3cce902e762c168280" title="Set Current Player.">setCurrentPlayer</a>(<span class="keywordtype">int</span> player);
<a name="l00208"></a>00208 
<a name="l00213"></a>00213         <span class="keywordtype">void</span> <a class="code" href="class_game.html#a055057cf58d0fed352a356ac49f0c6ca" title="Count Pieces.">countPieces</a>();
<a name="l00214"></a>00214 
<a name="l00215"></a><a class="code" href="class_game.html#a4a268816bf99bfad4bb6e9f874b347c4">00215</a>                 GameBoard <a class="code" href="class_game.html#a4a268816bf99bfad4bb6e9f874b347c4" title="The board as a vector of vectors of Pieces.">m_board</a>; 
<a name="l00216"></a><a class="code" href="class_game.html#ae59bbb9ed560c60679f518ea41df3f90">00216</a>                 std::vector&lt; GameBoard &gt; <a class="code" href="class_game.html#ae59bbb9ed560c60679f518ea41df3f90" title="The state history as a vector of boards.">m_stateHistory</a>; 
<a name="l00217"></a><a class="code" href="class_game.html#a8604ec6203f31ac5603bd597f49834d0">00217</a>                 <span class="keywordtype">bool</span> <a class="code" href="class_game.html#a8604ec6203f31ac5603bd597f49834d0" title="Debug mode on/off.">m_debug</a>; 
<a name="l00218"></a><a class="code" href="class_game.html#a72aa3904f6cc0b9adb37b228e5bd41e4">00218</a>                 <span class="keywordtype">int</span> <a class="code" href="class_game.html#a72aa3904f6cc0b9adb37b228e5bd41e4" title="The current player.">m_currentPlayer</a>; 
<a name="l00219"></a><a class="code" href="class_game.html#a3e45a5bc0402d7f2688141cd22151dfe">00219</a>                 std::string <a class="code" href="class_game.html#a3e45a5bc0402d7f2688141cd22151dfe" title="Game name.">m_name</a>; 
<a name="l00220"></a><a class="code" href="class_game.html#ad415cbb7ee6e23dd6a141d9221cc308a">00220</a>                 <span class="keywordtype">int</span> <a class="code" href="class_game.html#ad415cbb7ee6e23dd6a141d9221cc308a" title="Player 1 piece count.">numPiecesP1</a>; 
<a name="l00221"></a><a class="code" href="class_game.html#a8a6e2dfc4d3b47bfe9ce3eb8ae983abc">00221</a>                 <span class="keywordtype">int</span> <a class="code" href="class_game.html#a8a6e2dfc4d3b47bfe9ce3eb8ae983abc" title="Player 2 piece count.">numPiecesP2</a>; 
<a name="l00222"></a><a class="code" href="class_game.html#a9ec80071a59b011289d9fe4839e82b20">00222</a>                 <span class="keywordtype">int</span> <a class="code" href="class_game.html#a9ec80071a59b011289d9fe4839e82b20" title="Total move count.">m_moveCount</a>; 
<a name="l00223"></a>00223     <span class="keyword">private</span>:
<a name="l00224"></a>00224 
<a name="l00225"></a>00225 };
<a name="l00226"></a>00226 
<a name="l00227"></a>00227 <span class="preprocessor">#endif // GAME_H</span>
</pre></div></div><!-- contents -->


<hr class="footer"/><address class="footer"><small>
Generated on Sat May 12 2012 03:23:28 for Board game project by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.0
</small></address>

</body>
</html>
